package com.atguigu.spzx.manager.service.impl;

import com.atguigu.spzx.manager.mapper.ProductSpecMapper;
import com.atguigu.spzx.manager.service.ProductSpecService;
import com.atguigu.spzx.model.pojo.product.ProductSpec;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
* @author admin
* @description 针对表【product_spec(商品规格)】的数据库操作Service实现
* @createDate 2025-01-08 17:22:36
*/
@Service
@Transactional
public class ProductSpecServiceImpl extends ServiceImpl<ProductSpecMapper, ProductSpec>
    implements ProductSpecService{
    @Autowired
    private ProductSpecMapper productSpecMapper;

    @Override
    public Page<ProductSpec> findPage(Integer pageNum, Integer pageSize, String searchName) {
        Page<ProductSpec> page = new Page<>(pageNum, pageSize);
        QueryWrapper<ProductSpec> wrapper = null;
        if (StringUtils.isNotEmpty(searchName)){
            wrapper = new QueryWrapper<ProductSpec>().like("spec_name",searchName);
        }
        return productSpecMapper.selectPage(page, wrapper);
    }
}




